import express from 'express';
import { createServer } from 'http';
import { WebSocketServer } from 'ws';
import { Server as WsIoServer } from 'socket.io';
import { useApi } from './http';
import { useWs, useSocketIoIo, useMqtt } from './real-time';

const app = express();
const httpServer = createServer(app);
const ws = new WebSocketServer({ port: 3050 });
const io = new WsIoServer(httpServer, { cors: {} });
useApi(app);
useWs(ws);
useSocketIoIo(io);
useMqtt();

httpServer.listen(3000, () => {
  console.log('http://localhost:3000');
});
